-module (station).
-export(start/1).

start(InterfaceName, McastAddress, ReceivePort, UTCoffsetMs, StationClassAOrB) -> 
							{ok, MySocket} = gen_udp:open(ReceivePort),
							inet:setops(MySocket, [{active, true},{reuseaddr, true},{mode, binary}]),
							% When {active, true} delivers data on the forms port : {S, {data, [H1,..Hsz | Data]}} or term : {tcp, S, [H1..Hsz | Data]}. 
							% Allows or disallows local reuse of port numbers. By default, reuse is disallowed.
							% {mode, Mode :: binary | list}

    Received Packet is delivered as defined by Mode.

							
							run(UTCoffsetMs,StationClassAOrB, MySocket).


							
run(UTCoffsetMs, StationClassAOrB, MySocket) ->
			receive -> 
				% port : {S, {data, [H1,..Hsz | Data]}} - S= Socket???, vermutlich ja
				port : {MySocket, {data, [H1,..Hsz | Data]}} ->  <<SendingStation:10/>,<SendingData:14>,<StationClass:1>,<SlotForNextSend:1>,<SendingTime:8/big-unsigned-integer>> = Data,
																.....
				
				Any
			
			
			end.
			
			
			
